package com.jomoo.css.common.core.vo;

import com.jomoo.css.common.core.model.IModelBase;
import com.jomoo.css.common.core.annotation.ModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 公共字段基础类
 */
@Data
public abstract class BaseEntityVO extends ExtBaseEntityVO implements IModelBase, java.io.Serializable {

    @ModelProperty(comment = "创建人")
    String createdBy;

    @ModelProperty(comment = "创建人")
    String createdByName;

    @ModelProperty(comment = "创建人")
    String createdByEnName;

    @ModelProperty(comment = "创建日期/时间")
    Date createDate;

    @ModelProperty(comment = "修改人")
    String modifiedBy;

    @ModelProperty(comment = "修改人")
    String modifiedByEnName;

    @ModelProperty(comment = "修改人")
    String modifiedByName;

    @ModelProperty(comment = "修改日期")
    Date modifiedDate;

    @ModelProperty(comment = "状态")
    String status;

    //	@Column(name = "BIZ_ORG_CODE",  length = 36)
//	@ModelProperty(comment="业务所属机构")
//	String bizOrgCode;
//
    @ModelProperty(comment = "数据产生机构,")
    String operationOrgCode;

    @ModelProperty(comment = "数据分区键")
    String dataOwner;

    @ModelProperty(comment = "数据归属")
    String tenantId;

    @ModelProperty(comment = "归档基准日期")
    Date archiveBaseDate;

    //	@Version //如果使用这个注解,update时会带上RECORD_VERSION=?作为更新条件.和baseEntity.setVersionId(baseEntity.getVersionId()==null?1:baseEntity.getVersionId()+1);冲突
    @ModelProperty(comment = "记录版本号，每次修改记录时加1")
    Integer versionId;

    @ModelProperty(comment = "删除标记", des = "1==true 有效;0==false 无效")
    String delFlag = "0";

    @ModelProperty(comment = "删除人")
    String deleteBy;

    @ModelProperty(comment = "删除时间")
    Date deleteDate;

    @ModelProperty(comment = "是否已经执行审计日志")
    boolean isLog = false;

    @ModelProperty(comment = "子系统")
    private String subSystem;

	public abstract String getId();

	public abstract void setId(String id);
    /**
     * 重置基础字段,但不包含id
     */
    public void resetBase() {
        this.setId(null);
        this.createdBy = null;
        this.createdByEnName = null;
        this.createdByName = null;
        this.createDate = null;
        this.modifiedBy = null;
        this.modifiedByEnName = null;
        this.modifiedByName = null;
        this.modifiedDate = null;
        this.status = null;
        this.operationOrgCode = null;
        this.dataOwner = null;
        this.tenantId = null;
        this.archiveBaseDate = null;
        this.versionId = null;
        this.delFlag = null;
        this.deleteBy = null;
        this.deleteDate = null;
        this.subSystem = null;
    }
}